#!/usr/bin/perl 



my $a=0;
my @field;


sub addShip 
{
	my($ship) = @_;
	my $y1 = int($ship / 1000);
	my $x1 = (int($ship / 100)) % 10;
	my $y2 = (int($ship / 10)) % 10;
	my $x2 = (int($ship / 1)) % 10;
	
	if($ship =~ /^[0-9]{4}$/ && ( $x1 == $x2 || $y1 == $y2 ) )
	{

    		for(my $i=$x1; $i<=$x2; $i++)
		{       

       			for(my $j=$y1; $j <=$y2; $j++)
			{

         			$field[$j*10+$i] = "";
			}
		}
	}
	else {
		print "Error\n";
	}
}


for (my $i=0; $i<100; $i++)
{
	$field[$i]="*";
}



while (my $arg = shift @ARGV)
{
	addShip($arg);
}


for( my $k=0; $k<100; $k++)
{
	print "$field[$k]";
	
		print "\n" if( ($k+1)%10 == 0);
}

